package com.youlai.boot.agent.tools;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.youlai.boot.gym.model.entity.Members;
import com.youlai.boot.gym.service.MembersService;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class MemberTools {

    @Autowired
    private MembersService memberService;


    @Tool(value = "根据传入的日期,查询出在传入日期之前健身房卡到期的会员,默认只返回用户的姓名和会员卡的到期时间")
     public List<Members> queryMembersByData( @P(value = "日期")String date) {
        List<Members> list = memberService.list(new LambdaQueryWrapper<Members>().lt(Members::getMembershipEnd, date));
        return list;
    }
}
